home *** CD-ROM | disk | FTP | other *** search
- Path: crchh327.rich.bnr.ca!news
- From: Mike Hall <arnab@bnr.ca>
- Newsgroups: comp.lang.c++
- Subject: usage of ostrstream
- Date: 22 Jan 1996 23:50:58 GMT
- Organization: Bell Northern Research
- Message-ID: <4e17t2$24v@crchh327.rich.bnr.ca>
- NNTP-Posting-Host: crchhe1d.rich.bnr.ca
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.1 (X11; I; HP-UX A.09.05 9000/712)
- X-URL: news:comp.lang.c++
-
- Hi,
- This is beginers query but any help is highly appreciated.
- I am working on C++ in HP-UX environment.
- I am trying to something like this in my code
- f()
- {
- ostrstream oss;
-
- oss<<"The first string"<<ends
- cout << oss.str()<<endl;
-
- oss.seekp(0);
- oss<<"The second string in the same oss"<<ends;
- cout << oss.str()<<endl;
- }
-
- My test tool shows that the above has memory leaks.
- On reading the man pages I found that once .str() is
- called the buffer freezes and further usage of the oss
- object is unpredictable.Also the user should delete the
- char * returned by the .str().
-
- What I'd like to know is, a way to use/access the ostrstream
- string multiply in a function without having to create a
- ostrstream type object everytime.
-
- Please E-Mail to arnab@bnr.ca
-
- Thanks in advance for your help/suggestions
- Arnab
-
-